<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <img src="../图片/1.jpg" alt="111" width="300">
  <canvas id="container" width="1300" height="1300"></canvas>
  <script>
    function demo() {
      const canvas = document.getElementById('container')
      if (!canvas.getContext) return
      const ctx = canvas.getContext('2d')

      const img = document.querySelector('img')
      ctx.drawImage(img, 0, 0)
    }
    document.querySelector("img").onclick = function () {
      demo()
    }


  </script>
</body>

</html>